<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        li{
            border: 1px solid #999;
            margin:5px;
            line-height: 35px;
            padding-left:5px;
            font-size:12px;
            width:100%;
            list-style: none;
        }
        li:hover{
            background-color:cornflowerblue;
            transform:all 8s ease;
        }
        .v-enter,.v-leave-to{
            opacity:0;
            transform:translateY(80px);
        }
        .v-enter-active,.v-leave-active{
            transition:all .5s ease;
        }
        .v-move{
            transition:all .5s ease;
        }
        .v-leave-active{
            position:absolute;
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="">
            <label for="">学号：<input type="text"v-model="id"></label>
                <label for="">姓名：<input type="text"v-model="name"></label>
                    <input type="button" value="添加"@click="add">
        </div>
        <ul>
            <transition-group appear>
                <li v-for="(item,i) in list" :key="item.id" @click="del(i)">
                    {{item.id}} ---- {{item.name}}
                </li>
            </transition-group>
        </ul>
    </div>
    <script src="/JS文件/vue.js"></script>
    <script>
        var vm = new Vue({
            el:'#app',
            data:{
                id:'',
                name:'',
                list:[
                    {id:1,name:'张三'},
                    {id:2,name:'张四'},
                    {id:3,name:'张五'},
                    {id:4,name:'张六'}
                ]
            },
            methods: {
                add(){
                    this.list.push({id:this.id,name:this.name})
                    this.id = this.name=""
                },
                del(i){
                    this.list.splice(i,1);
                }
            },
        })
    </script>
</body>
</html>